<template>
<div class="info-body">
  <template v-for="item in commentinfo">
    <comment :commentsinfo="item"/>
  </template>
</div>
</template>

<script>
import comment from "../../playgame/comments/comment.vue";
import {storeToRefs} from "pinia";
import {mainStore} from "../../../../store";
import {usercomments} from "../../../api/getdata";

export default {
  name: "index",
  components:{
    comment
  },
  data(){
    const { islogin,user,token } = storeToRefs(mainStore())
    return{
      user,
      commentinfo:[]
    }
  },
  created() {
    console.log(this.gameid)
    this.getdata()
  },
  methods:{
    async getdata() {
      const params = {
        username: this.user.username
      }
      this.commentinfo = await new Promise(((resolve, reject) => {
        usercomments(params).then(res => {
          resolve(res.data)
        })
      }))
      console.log(this.commentinfo)
    }
  }
}
</script>

<style scoped>
.info-body{
  width: 1500px;
  margin: 10px auto 0;
}
</style>
